package org.jawa.exam.model;

import java.util.Date;

import org.jawa.core.cache.CacheSizes;
import org.jawa.core.cache.Cacheable;
import org.jawa.core.cache.CannotCalculateSizeException;

/**
 * 
 * 类文件: ExamUser
 * <p>
 * <p>
 * 类描述：考试用户表
 * <p>
 * 作     者： migrant423
 * <p>
 * 日     期： 2012-7-16
 * <p>
 * 时     间： 下午8:32:27
 * <p>
 */
public class ExamUser implements Cacheable {

	private static final long serialVersionUID = -6333265355634458866L;

	/**
	 * 考试编号
	 */
	private Long examId;
	/**
	 * 用户编号
	 */
	private Long userId;
	/**
	 * 用户分数
	 */
	private double userScore;
	/**
	 * 答题开始时间
	 */
	private Date startTime;
	/**
	 * 答题结束时间
	 */
	private Date endTime;
	/**
	 * 答题共用时间
	 */
	private Long totalTime;
	
	public Long getExamId() {
		return examId;
	}

	public void setExamId(Long examId) {
		this.examId = examId;
	}

	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	public double getUserScore() {
		return userScore;
	}

	public void setUserScore(double userScore) {
		this.userScore = userScore;
	}

	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public Long getTotalTime() {
		return totalTime;
	}

	public void setTotalTime(Long totalTime) {
		this.totalTime = totalTime;
	}

	public int getCachedSize() throws CannotCalculateSizeException {
		int size = 0;
		size += CacheSizes.sizeOfObject(); // overhead of object
		size += CacheSizes.sizeOfLong(); // userId
		size += CacheSizes.sizeOfLong(); // totalTime
		size += CacheSizes.sizeOfDouble();//userScore
		size += CacheSizes.sizeOfDate();
		size += CacheSizes.sizeOfDate();
		return size;
	}

}
